// 使用 Mock
let Mock = require('mockjs')
let Random = Mock.Random
let branches = [
    {
        repoId: 1,
        id: 1,
        name: 'dev_sunflower_B012',
    },
    {
        repoId: 1,
        id: 2,
        name: 'dev_sunflower_B013',
    },
    {
        repoId: 1,
        id: 3,
        name: 'dev_sunflower_B014',
    },
    {
        repoId: 1,
        id: 4,
        name: 'dev_sunflower_B015',
    },
    {
        repoId: 1,
        id: 5,
        name: 'dev_sunflower_B016',
    },
]
Random.extend({
    constellation: function() {
        return this.pick(branches)
    }
})
let MockDB = Mock.mock({
    'models|6': [
        {
            'id|+1': 1,
            'name': () => Random.email(),
        },
    ],
    'models-data|5': [
        {
            'id|+1': 1,
            'name': () => Random.email(),
            'repos|5': [
                {
                    'id|+1': 1,
                    'name': () => Random.string('lower', 3, 6),
                    'currentBranch': () => Random.constellation(),
                    'branches': branches
                }
            ]
        },
    ],
})
// 输出结果
export {MockDB}